Use arduino_ci
to run unit tests as part of git pull requests (not just tests of compilation)
#91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: adafruit/ci-arduino#16
I've created an alternative CI system to the
install.sh
method referenced in the above repository. This was a personal project and I make no claim that it is better for your purposes than what you have now. However, since the development was heavily inspired byinstall.sh
and the proof of concept was built against this library, it seems appropriate to submit my work for your consideration.Scope of change
Only the CI-related scripts have been changed, and of that functionality, no compilation steps have been removed*. In fact, I've added some example unit tests (which are enabled by my new ruby gem) that increase the amount of testing.
No changes to the library itself have been made.
(* except for boards whose compilation failed due to a lack of
SoftwareSerial
availability -- I edited the config to avoid compiling against those. If that was in error, that might indicate a bug in my system.)Please run any tests or examples that can exercise your modified code
I'm glad you asked. This pull request enables unit tests to happen as part of Travis CI. The results will be visible there as TAP-13-formatted output. You can see my own battery of tests (for the library itself and all its components) in this Travis CI job.
I've added a test of
getIMEI
as a demonstration, see https://github.com/adafruit/Adafruit_FONA/compare/master...ianfixes:2018-03-05_arduino_ci_unit_tests?expand=1#diff-38242b01e4859016b646adf632a7cbacR83This is accomplished in two pieces. First, we need to create a mock of the serial device that the FONA code will be talking to. That's as simple as extending an existing class called
DeviceUsingBytes
from thearduino_ci
cpp library:Note the definitions of requests and responses (i.e.
AT
will prompt a response ofOK
), and theonMatchInput
function which sets the digital pin state to a sequence of ASCII bits. The outcome of this will be that theSoftwareSerial
library listening onFONA_TX
will receive what looks like a response from a real device.The actual unit test looks like this (extra annotations added here):
I don't expect this to be merged anytime soon, but I welcome any comments/criticisms/suggestions on the
arduino_ci
library and methodology itself. Thanks for inspiring me to write it!